package com.zhoulu.config;

import com.zhoulu.domain.util.LayuiResult;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;


@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = AuthorizationException.class)
    @ResponseBody
    public Object jsonExceptionHandler(HttpServletRequest request, Exception e) {
        return LayuiResult.error("抱歉，您没有权限");
    }
}
